package com.myself.pattern.factory.abstractfactory;

public class ComputerEngineer {

	@SuppressWarnings("unused")
	private ICpu cpu;

	@SuppressWarnings("unused")
	private IMainBoard mainBoard;

	public void assembleComputer(String customerRequirements) {
		String vender = null;
		if ("CPU要Intel Core I7的".equals(customerRequirements)) {
			vender = "Intel";
		}
		prepareHardware(vender);
	}

	private void prepareHardware(String vender) {
		IComputerPartsFactory factory = null;
		if ("Intel".equals(vender)) {
			factory = new IntelFactory();
		} else if ("AMD".equals(vender)) {
			factory = new AmdFactory();
		}

		cpu = factory.productCpu();
		mainBoard = factory.productMainBoard();
	};

}
